﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Themes/Shared/Seller.Master" Inherits="System.Web.Mvc.ViewPage<PagedList<Goods>>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="CssContent" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="MainContent" runat="server">
    <ul class="tab">
        <li class="active">商品列表</li>
        <li class="normal"><%=Html.ActionLink("发布产品", "AddGoods")%></li>
    </ul>
    <%using(Html.BeginForm("SelDelete","Seller",FormMethod.Post)){ %>
    <div class="listView">
        <table width="100%" cellspacing="0" cellpadding="0" border="0">
            <tr>
                <th></th>
                <th>ID</th>
                <th>商品名称</th>
                <th>数量</th>
                <th>价格</th>
                <th>操作</th>
            </tr>
            <%foreach (Goods data in Model){ %>
            <tr>
                <td width="30" align="center"><input type="checkbox" name="chkSingle" value="<%=data.ID %>" class="chkSingle" /></td>
                <td width="50"><%=data.ID %></td>
                <td><%=Html.ActionLink(data.Title, "Index", "Goods", new { id = data.ID }, new { target = "_blank" })%></td>
                <td><%=data.Amount %></td>
                <td><%=data.Price %></td>
                <td width="70" align="center">
                    <%=Html.ActionLink("编辑","EditGoods", new RouteValueDictionary(){{"id",data.ID}})%>
                    |
                    <%=Html.ActionLink("删除","Del", new RouteValueDictionary(){{"id",data.ID}})%>
                </td>
            </tr>
            <%} %>
            <tr style="background:#FFF;">
                <td width="30" align="center"><%=Html.CheckBox("chkAll", new { @class = "chkAll" })%></td>
                <td colspan="5"><input type="submit" value="删除" /></td>
            </tr>
        </table>
        <div class="pager" style="clear: both; padding-top: 10px">
            <%= Html.Pager("ProductList","Seller",Model.PageIndex, Model.PageSize, Model.TotalCount)%>
        </div>
    </div>
    <%} %>
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="JsContent" runat="server">
<script language="javascript" type="text/javascript">
    $(function () {
        $(".chkAll").click(function () {
            if ($(this).attr("checked") == true) {
                $(".chkAll").attr("checked", true);
                $(".chkSingle").attr("checked", true);
            } else {
                $(".chkAll").attr("checked", false);
                $(".chkSingle").attr("checked", false);
            }
        });
        $(".chkSingle").click(function () {
            var tag = true;
            $(".chkSingle").each(function () {
                if ($(this).attr("checked") == false) {
                    tag = false;
                }
            });
            $(".chkAll").attr("checked", tag);
        });
    });
</script>
</asp:Content>
